<%-- 
    Document   : doBook
    Created on : 02.08.2009, 21:08:32
    Author     : Mario
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../STYLES/serverStyles.css" />
        <title>FBIS - ADMIN / BUCHUNG / BUCHEN</title>
    </head>
    <body>
        <jsp:useBean id="bookings" scope="application" class="de.stalinski.db.BookingsConnector" />
        <%
        String consumer = request.getParameter("consumer");
        String sn = consumer.substring(0, consumer.indexOf(","));
        String fn = consumer.substring(consumer.indexOf(",") + 2, consumer.length());
        String reqValue = request.getParameter("val");

        boolean valid = true;

        if (reqValue.equals("")) {
            reqValue = "0.0";
        }
        double value = 0.0;
        try {
            value = Double.parseDouble(reqValue);
        } catch (Exception e) {
            out.println("Ungültigen Wert angegeben!");
            valid = false;
        }
        if (valid && value > 0) {
            bookings.book(fn, sn, value);
            out.print("Buchung erfolgreich!");
            %>
                <meta http-equiv="refresh" content="1;../USERMANAGEMENT/users.jsp">
            <%
        } else {
            out.print("Ungültigen Wert eingegeben!");
        }        
        %>

        <meta http-equiv="refresh" content="1;../USERMANAGEMENT/users.jsp">
    </body>
</html>
